<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- <script type="module">
        import {
          onCLS,
          onINP,
          onLCP,
        } from 'https://unpkg.com/web-vitals@4/dist/web-vitals.attribution.js?module';
      
        onCLS(console.log);
        onINP(console.log);
        onLCP(console.log);
      </script> -->
</head>
<body>
   <!-- <div>test</div> -->
</body>
<script>
  window.addEventListener("pageshow",(event) => {
        requestAnimationFrame(() => {
            ['load'].forEach((type) => {
              console.log('test===',performance.now() - event.timeStamp);
                // const reportData = {
                //     type:"performace",
                //     subType:type,
                //     pageUrl:window.location.href,
                //     startTime:performance.now() - event.timeStamp
                // }
            })
        },true);
    })
//     window.addEventListener("load", () => {
//     const loadTime = performance.timing.loadEventEnd - performance.timing.navigationStart;
//     console.log("页面 onload 时间：", loadTime, "毫秒");
// });

const observer = new PerformanceObserver((list) => {
  console.log(list.getEntries(),list);
    for (const entry of list.getEntries()) {
      observer.disconnect();
        if (entry.entryType === "navigation") {
            console.log("页面 onload 时间：", entry.loadEventEnd - entry.startTime, "毫秒");
        }
    }
});
observer.observe({ type: "navigation", buffered: true });
</script>
</html>